package com.allwees.bs.core.modelbase.constant;

import lombok.Getter;

/**
 * 重构 Result Code, 用于同一国际化返回信息
 *
 * @author: Xiao Xuezhi
 * @email: index.xiao@foxmail.com
 * @date: 2020/12/17 10:33
 * @since: 1.0.0 业务代码使用枚举, 资源文件使用 code=msg, 现阶段 code(数字)未定, 暂时使用枚举类名+枚举名代替,
 * 例: ResultEnum.SUCCESS=success
 */
@Getter
public enum ResultEnum {

    // ***************************** 通用部分 *****************************

    SUCCESS(ResultCode.SUCCESS),

    EXCEED_ACCESS_LIMIT(ResultCode.EXCEED_ACCESS_LIMIT),

    INVALID_TOKEN(ResultCode.INVALID_TOKEN),

    BAD_CREDANCIALS(ResultCode.INVALID_TOKEN),

    UNAUTHORIZED(ResultCode.UNAUTHORIZED),

    USERS_ORIGIN_PASSWORD_NOT_VALID(ResultCode.USERS_ORIGIN_PASSWORD_NOT_VALID),

    USERS_NO_PASSWORD_SET(ResultCode.USERS_NO_PASSWORD_SET),

    USERS_CHANGE_EMAIL_WITH_SAME(ResultCode.USERS_CHANGE_EMAIL_WITH_SAME),

    USERS_CHANGE_EMAIL_WITH_EXISTS(ResultCode.USERS_CHANGE_EMAIL_WITH_EXISTS),

    VERIFY_CODE_NOT_VALID(ResultCode.VERIFY_CODE_NOT_VALID),

    USER_EMAIL_IS_EMPTY(ResultCode.USER_EMAIL_IS_EMPTY),

    VERIFY_CODE_EXPIRED(ResultCode.VERIFY_CODE_EXPIRED),

    DATA_NO_PRIVILEGE(ResultCode.DATA_NO_PRIVILEGE),

    AT_LEAST_ONE_DEFAULT(ResultCode.AT_LEAST_ONE_DEFAULT),

    /**
     * 减少使用SERVER_ERROR 太笼统 理解困难 即使日志中打印也不知道是什么问题
     */
    @Deprecated
    SERVER_ERROR(ResultCode.SERVER_ERROR),

    CONSISTENCY_ERROR(ResultCode.CONSISTENCY_ERROR),

    CONVERT_ERROR(ResultCode.CONVERT_ERROR),

    FORMAT_ERROR(ResultCode.FORMAT_ERROR),

    ENCODE_ERROR(ResultCode.ENCODE_ERROR),

    PARAM_ERROR(ResultCode.PARAM_ERROR),

    NOT_FOUND(ResultCode.NOT_FOUND),

    ALREADY_EXISTS(ResultCode.ALREADY_EXISTS),

    COUPON_NOT_FOUND(ResultCode.COUPON_NOT_FOUND),

    COUPON_EXPIRED(ResultCode.COUPON_EXPIRED),

    USER_CASH_INSUFFICIENT(ResultCode.USER_CASH_INSUFFICIENT),

    USER_COUPON_USED(ResultCode.USER_COUPON_USED),

    MOBILE_VALIDATE_ERROR(ResultCode.MOBILE_VALIDATE_ERROR),

    // ***************************** 订单部分 *****************************

    ORDER_NOT_SUCCESS(ResultCode.ORDER_NOT_SUCCESS),
    ORDER_NOT_REVIEWABLE(ResultCode.ORDER_NOT_REVIEWABLE),
    ORDER_REPEAT_REVIEW(ResultCode.ORDER_REPEAT_REVIEW),
    ORDER_SKU_QUANTITY_NOT_ENOUGH(ResultCode.ORDER_SKU_QUANTITY_NOT_ENOUGH),
    ORDER_PRODUCT_OFF_SHELVES(ResultCode.ORDER_PRODUCT_OFF_SHELVES),
    ORDER_CANNOT_CANCEL_PAID(ResultCode.ORDER_CANNOT_CANCEL_PAID),
    ORDER_CANNOT_REQUEST_REFUND(ResultCode.ORDER_CANNOT_REQUEST_REFUND),
    ORDER_CANNOT_CONFIRM_SHIPPING(ResultCode.ORDER_CANNOT_CONFIRM_SHIPPING),
    ORDER_ITEM_MUST_INCLUDE_SKU(ResultCode.ORDER_ITEM_MUST_INCLUDE_SKU),
    ORDER_CANNOT_APPROVE_REFUND(ResultCode.ORDER_CANNOT_APPROVE_REFUND),
    ORDER_CANNOT_CANCEL_REFUND(ResultCode.ORDER_CANNOT_CANCEL_REFUND),
    ORDER_TRACK_SHIPPING_ERROR(ResultCode.ORDER_TRACK_SHIPPING_ERROR),
    ORDER_EXCEED_REFUND_LIMIT(ResultCode.ORDER_EXCEED_REFUND_LIMIT),
    ORDER_SHIPPING_WRONG_LOGISTIC(ResultCode.ORDER_SHIPPING_WRONG_LOGISTIC),
    ODDER_PRODUCT_SUM_LIMIT(ResultCode.ODDER_PRODUCT_SUM_LIMIT),
    ORDER_CANNOT_SHIP(ResultCode.ORDER_CANNOT_SHIP),
    ORDER_CANNOT_PRINT(ResultCode.ORDER_CANNOT_PRINT),
    ORDER_CANNOT_DELIVER(ResultCode.ORDER_CANNOT_DELIVER),

    ORDER_MORE_THAN_ONE_FREEGIFT(ResultCode.ORDER_MORE_THAN_ONE_FREEGIFT),


    // ***************************** 支付部分 *****************************

    PAYMENT_ORDER_STATE_IS_NOT_UNPAID(ResultCode.PAYMENT_ORDER_STATE_IS_NOT_UNPAID),
    PAYMENT_REFUND_ORDER_ID_NOT_MATCH(ResultCode.PAYMENT_REFUND_ORDER_ID_NOT_MATCH),
    PAYMENT_REFUND_PAYMENT_NOT_APPROVED(ResultCode.PAYMENT_REFUND_PAYMENT_NOT_APPROVED),

    PAYMENT_PAYPAL_CREDITCARD_ERROR(ResultCode.PAYMENT_PAYPAL_CREDITCARD_ERROR),

    PAYMENT_PAYPAL_CREATE_ERROR(ResultCode.PAYMENT_PAYPAL_CREATE_ERROR),

    PAYMENT_COD_PAY_ERROR(ResultCode.PAYMENT_COD_PAY_ERROR),

    PAYMENT_PAYBY_QUERY_ERROR(ResultCode.PAYMENT_PAYBY_QUERY_ERROR),

    PAYMENT_PAYBY_TRANSFER_QUERY_ERROR(ResultCode.PAYMENT_PAYBY_TRANSFER_QUERY_ERROR),

    PAYMENT_PAYBY_TRANSFER_ERROR(ResultCode.PAYMENT_PAYBY_TRANSFER_ERROR),



    // ***************************** 商品部分 *****************************

    PHONE_NOT_EXIST(ResultCode.SUCCESS),
    EMAIL_ALREADY_EXISTS(ResultCode.ALREADY_EXISTS),

    // ***************************** 库存部分 *****************************
    NO_STOCK_ERROR(ResultCode.NO_STOCK_ERROR),
    PRODUCT_LIMIT_CHECKOUT(ResultCode.PRODUCT_LIMIT_CHECKOUT),
    PRODUCT_LIMIT_CART(ResultCode.PRODUCT_LIMIT_CART),

    // ***************************** 三方登录 *****************************

    THIRD_PARTY_ERROR(ResultCode.THIRD_PARTY_ERROR),
    THIRD_PARTY_STATUS_ERROR(ResultCode.THIRD_PARTY_STATUS_ERROR),
    UPLOAD_OSS_FAILED(ResultCode.UPLOAD_OSS_FAILED),
    CREATE_EXPRESS_FAILED(ResultCode.CREATE_EXPRESS_FAILED),
    CARRIER_NOT_FOUND(ResultCode.CARRIER_NOT_FOUND),
    TRACKING_NOT_FOUND(ResultCode.TRACKING_NOT_FOUND),

    // ***************************** 参数校验 *****************************
    PARAM_NOT_NULL(ResultCode.PARAM_ERROR),
    PARAM_LENGTH_ERROR(ResultCode.PARAM_ERROR),
    PARAM_RANGE_ERROR(ResultCode.PARAM_ERROR),
    PARAM_TYPE_NOT_MATCH(ResultCode.PARAM_ERROR),

    // ***************************** 地址 *****************************
    REGION_NOT_SUPPORT(ResultCode.REGION_NOT_SUPPORT),

    ;

    private int code;

    ResultEnum(int code) {
        this.code = code;
    }
}
